package com.example.xjt.orm.mr;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "t_menu_role")
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update t_menu_role set is_del = 1 where id = ?")
@Where(clause = "is_del = 0")
@DynamicUpdate
@DynamicInsert
@org.hibernate.annotations.Table(appliesTo = "t_menu_role",comment="前端菜单-后端角色-关系表")
public class MenuRole {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private Long mid;

    private Long rid;


    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '备注'")
    private String remark;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @Column(name = "create_time",columnDefinition = "datetime DEFAULT NULL COMMENT '添加时间'")
    @CreatedDate
    private Date createTime;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @Column(name = "update_time",columnDefinition = "datetime DEFAULT NULL COMMENT '修改时间'")
    @LastModifiedDate
    private Date  updateTime;


    @Column(name = "is_del", columnDefinition = "int(1)  DEFAULT 0 COMMENT '逻辑删除标志'")
    private Integer isDel=0;


}
